﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Medical.Entity;
using Medical.Business;
using System.Data;

/// <summary>
/// 关于我们页面
/// </summary>
public partial class About : WebPage
{
    protected int nCount = 1;

    protected DataTable dtMeta = null;

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            DataRow[] drList = Until.GetSEO().Select("Type=2");
            if (drList.Length > 0)
                SetPageInfo(drList[0]["PageTitle"].ToString() == string.Empty ? ("医院简介_" + strWebTitle) : drList[0]["PageTitle"].ToString(), drList[0]["PageKeywords"].ToString(), drList[0]["PageDescription"].ToString());
            InitData();
        }
    }

    /// <summary>
    /// 数据初始化
    /// </summary>
    protected void InitData()
    {
        
        //简介
        BisArticle bisArticle = new BisArticle();
        Article aboutInfo = bisArticle.GetArticle(ArticelTypeEnum.About, 1);
        if (aboutInfo != null)
        {
            ltlInfo.Text = aboutInfo.Info;
        }

        //专家团队
        DataTable dtDoctor = bisArticle.GetTopArticle(9,ArticelTypeEnum.Expert);
        rptDoctor.DataSource = dtDoctor;
        rptDoctor.DataBind();
        rptDoctor1.DataSource = dtDoctor;
        rptDoctor1.DataBind();
        rptDoctor2.DataSource = dtDoctor;
        rptDoctor2.DataBind();
        dtDoctor.Dispose();

        //媒体报道
        DataTable dtNews = bisArticle.GetTopArticle(4, ArticelTypeEnum.News, 52);
        rptNews.DataSource = dtNews;
        rptNews.DataBind();
        dtNews.Dispose();

       //技术
        //DataTable dtTel = bisArticle.GetTopArticleByPartType(6, ArticelTypeEnum.Technology,1);
        //rptTel.DataSource = dtTel;
        //rptTel.DataBind();
        //dtTel.Dispose();

        //荣誉
        DataTable dtAboutAd = new BisBanner().GetList(AdverTypeEnum.Honor);
        rptAboutAd.DataSource = dtAboutAd;
        rptAboutAd.DataBind();
        dtAboutAd.Dispose();

        //医院环境
        DataTable dtEnvironment = new BisBanner().GetList(AdverTypeEnum.Environment);
        rptEnvironment.DataSource = dtEnvironment;
        rptEnvironment.DataBind();

        //尖端设备
        DataTable dtEquipment = new BisArticle().GetArticleImgPlace(ArticelTypeEnum.Equipment, 0);
        rptEquipment.DataSource = dtEquipment;
        rptEquipment.DataBind();
        rptEquipment1.DataSource = dtEquipment;
        rptEquipment1.DataBind();
        
    }

    /// <summary>
    /// 列表绑定处理
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void rptNews_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        DataTable dtSort = (DataTable)((Repeater)sender).DataSource;
        Literal ltlInfo = e.Item.FindControl("ltlInfo") as Literal;
        string strInfo = strInfo = Common.NoHTML(dtSort.Rows[e.Item.ItemIndex]["Info"].ToString());
        ltlInfo.Text = (strInfo.Length > 85 ? strInfo.Substring(0, 85) : strInfo) + "…";
    }

    
    /// <summary>
    /// 列表绑定处理
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void rptTel_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        DataTable dtSort = (DataTable)((Repeater)sender).DataSource;
        Literal ltlInfo = e.Item.FindControl("ltlInfo") as Literal;
        string strInfo = strInfo = Common.NoHTML(dtSort.Rows[e.Item.ItemIndex]["Info"].ToString());
        ltlInfo.Text = (strInfo.Length > 80 ? strInfo.Substring(0, 80) : strInfo) + "…";
    }

    /// <summary>
    /// 列表绑定处理
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void rptDoctor_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        nCount++;
        DataTable dtSort = (DataTable)((Repeater)sender).DataSource;
        Literal ltlInfo = e.Item.FindControl("ltlInfo") as Literal;
        string strInfo = strInfo = Common.NoHTML(dtSort.Rows[e.Item.ItemIndex]["Info"].ToString());
        ltlInfo.Text = (strInfo.Length > 150 ? strInfo.Substring(0, 150) : strInfo) + "…";
    }


   
}